//
//  RefreshView.swift
//  App_Common_Views
//
//  Created by 蒋晨成 on 2022/1/14.
//

import Foundation
import PullToRefreshKit

public enum RefreshView {
    public static func header() -> SimpleRefreshHeader {
        let header = SimpleRefreshHeader()
        header.setText(CommonViewsModular.localizedString(key: "UICollectionView.RefreshHeader.ReleaseToRefresh"), mode: .pulling)
        header.setText(CommonViewsModular.localizedString(key: "UICollectionView.RefreshHeader.PullToRefresh"), mode: .idle)

        return header
    }

    public static func footer() -> DefaultRefreshFooter {
        let footer = DefaultRefreshFooter.footer()
        footer.setText(CommonViewsModular.localizedString(key: "UICollectionView.RefreshFooter.PullUpToRefresh"), mode: .pullToRefresh)
        footer.setText(CommonViewsModular.localizedString(key: "UICollectionView.RefreshFooter.NoDataAnyMore"), mode: .noMoreData)
        footer.setText(CommonViewsModular.localizedString(key: "UICollectionView.RefreshFooter.Refreshing..."), mode: .refreshing)
        footer.setText(CommonViewsModular.localizedString(key: "UICollectionView.RefreshFooter.TapToLoadMore"), mode: .tapToRefresh)
        footer.setText(CommonViewsModular.localizedString(key: "UICollectionView.RefreshFooter.ScrollOrTapToLoad"), mode: .scrollAndTapToRefresh)
        footer.textLabel.textColor = .lightGray
        footer.isHidden = true
        return footer
    }
}
